﻿<UserControl xmlns:ParseControls="clr-namespace:ParseControls;assembly=ParseControls"  x:Class="ParseOnlineAdmin.ParseRelatedTasks"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:local="clr-namespace:ParseOnlineAdmin"
			 mc:Ignorable="d" d:DesignHeight="100" d:DesignWidth="300">

	<UserControl.Resources>

		<local:ParseObjectToStringConverter x:Key="valueConverter" />

		<Thickness x:Key="BorderThickness" Bottom="1" Left="1" Top="1" Right="1" />
		<SolidColorBrush x:Key="BorderBrush" Color="#999" />
		<SolidColorBrush x:Key="ForegroundBrush" Color="#555" />
		<SolidColorBrush x:Key="BackgroundBrush" Color="#fff" />
		<SolidColorBrush x:Key="LightBrush" Color="#ddd" />
		<SolidColorBrush x:Key="AccentBrush" Color="#eee" />
		<SolidColorBrush x:Key="transp" Color="Transparent"  Opacity="0" />
		<SolidColorBrush x:Key="snow" Color="Transparent" Opacity="0.0001" />
		<SolidColorBrush  x:Key="min"  Color="White" Opacity="0.05" />
		<SolidColorBrush  x:Key="light"  Color="White" Opacity="0.1" />
		<SolidColorBrush x:Key="over" Color="White"  Opacity="0.3" />
		<SolidColorBrush x:Key="selected"  Color="White"  Opacity="0.5" />

		<!-- FocusVisual -->
		<Style x:Key="SimpleFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Border
						BorderBrush="Transparent"
						BorderThickness="0"
						SnapsToDevicePixels="true">
							<!--
							<Border.Effect>
							<DropShadowEffect ShadowDepth="0"
							Color="Gray"
							BlurRadius="5" />
							</Border.Effect>
						-->
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="listboxitem" TargetType="ListBoxItem">
			<Setter Property="Opacity" Value="0" />
			<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
			<Setter Property="RenderTransform">
				<Setter.Value>
					<TranslateTransform Y="-10" />
				</Setter.Value>
			</Setter>
			<Setter Property="FocusVisualStyle" Value="{StaticResource SimpleFocusVisual}" />
			<Setter Property="BorderBrush" Value="#ccc" />
			<Setter Property="SnapsToDevicePixels"  Value="True" />
			<Setter Property="BorderThickness" Value="1,1,1,1" />
			<!--<Setter Property="Margin" Value="0,2,0,3" />
			<Setter Property="Padding" Value="0,2,0,3" />-->
			<Setter Property="Foreground" Value="#333" />
			<Setter Property="Background" Value="#fff" />
			<Setter Property="HorizontalContentAlignment" Value="Stretch" />
			<Setter Property="HorizontalAlignment" Value="Stretch" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="ListBoxItem">
						<Grid Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
							<Rectangle x:Name="rectBg" SnapsToDevicePixels="true" />
							<Border x:Name="line" Background="{TemplateBinding Background}"
								BorderBrush="{TemplateBinding BorderBrush}" 
									BorderThickness="{TemplateBinding BorderThickness}"
								SnapsToDevicePixels="true" />


							<ContentPresenter Margin="0" HorizontalAlignment="Stretch" 
								Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"
								SnapsToDevicePixels="true" />
						</Grid>
						<ControlTemplate.Triggers>
							<EventTrigger RoutedEvent="Loaded">
								<BeginStoryboard>
									<Storyboard Storyboard.DesiredFrameRate="30">
										<DoubleAnimation AccelerationRatio="0.3" DecelerationRatio="0.7"
												Duration="0:0:0.7" From="0"
													Storyboard.TargetProperty="Opacity" To="1" />
										
							                <DoubleAnimation AccelerationRatio="0.3" DecelerationRatio="0.7"
													Duration="0:0:0.7" From="-10"
														Storyboard.TargetProperty="(UIElement.RenderTransform).(TranslateTransform.Y)" To="0" />
							
									</Storyboard>
								</BeginStoryboard>
							</EventTrigger>
							<Trigger Property="IsSelected" Value="True">
								<Setter Property="Opacity" TargetName="line" Value="1" />
								<Setter Property="Cursor" Value="Hand" />
								<Setter Property="Background" TargetName="line" Value="#efefef" />
								<Setter Property="TextBlock.Foreground" Value="#fff" />
							</Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="False" />
									<Condition Property="IsMouseOver" Value="True" />
								</MultiTrigger.Conditions>
								<Setter Property="Opacity" TargetName="line" Value="1" />
								<Setter Property="Cursor" Value="Hand" />
								<Setter Property="Background" TargetName="line" Value="#efefef" />
								<!--<Setter Property="Opacity" TargetName="rectBg" Value="0.5" />-->
							</MultiTrigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="True" />
									<Condition Property="IsMouseOver" Value="True" />
								</MultiTrigger.Conditions>
								<Setter Property="Opacity" TargetName="line" Value="1" />
							</MultiTrigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
			<Style.Triggers>
				<Trigger Property="IsEnabled" Value="false">
					<Setter Property="Background" Value="Silver" />
					<Setter Property="Foreground" Value="White" />
				</Trigger>
			</Style.Triggers>
		</Style>
		<Style x:Key="listbox" TargetType="{x:Type ListBox}">
			<Setter  Property="BorderThickness"  Value="0" />
			<Setter  Property="Margin"  Value="0" />
			<!--<Setter  Property="Padding"  Value="5" />-->
			<Setter Property="Background"  Value="Transparent" />
		</Style>
		<Style x:Key="textbox" TargetType="{x:Type TextBox}">
			<Setter Property="Background" Value="Transparent" />
			<Setter Property="BorderThickness" Value="0" />
			<Setter Property="BorderBrush" Value="Transparent" />
			<Setter Property="Padding" Value="3" />
			<Style.Triggers>
				<Trigger Property="IsMouseOver" Value="true">
					<Setter Property="Background" Value="{StaticResource over}" />
					<Setter  Property="BorderThickness"  Value="0" />
				</Trigger>
				<Trigger  Property="IsFocused" Value="true">
					<Setter  Property="Background" Value="{StaticResource selected}" />
					<Setter  Property="BorderThickness" Value="0" />
				</Trigger>
			</Style.Triggers>
		</Style>
		<Style x:Key="plainTextbox" TargetType="{x:Type TextBox}">
			<Setter Property="Background" Value="Transparent" />
			<Setter Property="BorderThickness" Value="0" />
			<Setter Property="BorderBrush" Value="Transparent" />
			<Setter Property="Padding" Value="3" />
			<Style.Triggers>
				<Trigger Property="IsMouseOver" Value="true">
					<Setter Property="Background" Value="{StaticResource min}" />
					<Setter  Property="BorderThickness"  Value="0" />
				</Trigger>
				<Trigger  Property="IsFocused" Value="true">
					<Setter  Property="Background" Value="{StaticResource light}" />
					<Setter  Property="BorderThickness" Value="0" />
				</Trigger>
			</Style.Triggers>
		</Style>

		<!-- Shadow -->
		<DropShadowEffect x:Key="shadow" BlurRadius="9" 
					  ShadowDepth="3" Color="#cccccc" 
				Direction="270" RenderingBias="Performance" />
		<DropShadowEffect x:Key="shadowWhite" BlurRadius="5" 
					  ShadowDepth="1" Color="#cccccc" 
				Direction="270" RenderingBias="Performance" />
		<DropShadowEffect x:Key="shadowLight" BlurRadius="5" 
					  ShadowDepth="1" Color="#f3f3f3" 
				Direction="270" RenderingBias="Performance" />
		<DropShadowEffect x:Key="shadowDark" BlurRadius="9" 
					  ShadowDepth="3" Color="#777777" 
				Direction="270" RenderingBias="Performance" />
		<DropShadowEffect x:Key="navigShadow" BlurRadius="5" ShadowDepth="2" 
					  Color="#777" RenderingBias="Performance" />
		
	</UserControl.Resources>

	<Grid Margin="0,5,0,5">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<!--<TextBlock Text="Aufgaben" FontWeight="Bold" Margin="5" Grid.Row="0" />-->

		<ListBox Margin="5,0" Padding="0" Grid.Row="1" ItemContainerStyle="{StaticResource listboxitem}"
					 Style="{StaticResource listbox}" BorderThickness="0" BorderBrush="Transparent"
						ItemsSource="{Binding Path=RelatedTaskItems, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}"
									ScrollViewer.HorizontalScrollBarVisibility="Hidden"
									ScrollViewer.VerticalScrollBarVisibility="Auto"
									SelectedItem="{Binding Path=SelectedRelatedTask, Mode=TwoWay,
										UpdateSourceTrigger=PropertyChanged}"
				  Effect="{StaticResource shadowDark}">
			<ListBox.ItemTemplate>
				<DataTemplate>
					<Grid SnapsToDevicePixels="true"  >
						<Grid.RowDefinitions>
							<RowDefinition Height="*" />
							<RowDefinition Height="*" />
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="Auto" />
							<ColumnDefinition Width="*" />
						</Grid.ColumnDefinitions>

						<Border SnapsToDevicePixels="true" Background="Transparent"
								   BorderBrush="#FFD11824" BorderThickness="0,0,1,0"
									Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Opacity="0.5" />

						<Border SnapsToDevicePixels="true" Margin="0,0,3,0" Background="Transparent"
								   BorderBrush="#FFD11824" BorderThickness="0,0,1,0"
									Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Opacity="0.5" />

						<CheckBox Width="30" Height="30"  SnapsToDevicePixels="true" Margin="10,3,0,3"
							VerticalContentAlignment="Center" HorizontalContentAlignment="Center" 
								VerticalAlignment="Center" HorizontalAlignment="Center" 
							Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" />

						<TextBlock Grid.Column="1"  Grid.Row="0"  Margin="8,5,3,5" 
									FontWeight="Bold" FontSize="14" Foreground="#777"
									VerticalAlignment="Center"
									Text="{Binding Converter={StaticResource valueConverter}, ConverterParameter=Title}"
									SnapsToDevicePixels="true" TextTrimming="CharacterEllipsis" />

					</Grid>
				</DataTemplate>
			</ListBox.ItemTemplate>
		</ListBox>

		<ParseControls:FwTextBox x:Name="txtTask" 
								 BackgroundText="Task erstellen..." KeyUp="TextBox_KeyUp"  
				 Style="{StaticResource textbox}" Margin="5,10" Grid.Row="2" />
	</Grid>
	
</UserControl>
